package com.example.busbus.service.impl;



import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.busbus.entity.BusLine;
import com.example.busbus.mapper.BusLineMapper;
import com.example.busbus.service.BusLineService;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class BusLineServiceImpl extends ServiceImpl<BusLineMapper, BusLine> implements BusLineService {

    @Override
    public List<BusLine> getAllBusLines() {
        return this.list();
    }

    @Override
    public BusLine getBusLineById(Long id) {
        return this.getById(id);
    }

    @Override
    public void addBusLine(BusLine busLine) {
        this.save(busLine);
    }

    @Override
    public void updateBusLine(BusLine busLine) {
        this.updateById(busLine);
    }

    @Override
    public void deleteBusLine(Long id) {
        this.removeById(id);
    }

    @Override
    public List<BusLine> searchByName(String name) {
        return this.lambdaQuery().eq(BusLine::getName, name).list();
    }

    @Override
    public List<BusLine> searchByLineNumber(String lineNumber) {
        return this.lambdaQuery().eq(BusLine::getLineNumber, lineNumber).list();
    }
}